<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>

  </style>
</head>

<body>
  <div id="app">
    <ul>
      <li v-for="item in arr">
        {{item}}
      </li>
    </ul>
    <hr>
    循环中得到下标
    <ul>
      <li v-for="(item, index) in arr">
        {{item}}
        ——>
        {{ index }}
      </li>
    </ul>
    <hr>
    循环对象
    <ul>
      <li v-for="value in json">
        {{ value }}
      </li>
    </ul>
    <hr>
    循环对象 得到key
    <ul>
      <li v-for="(value, key) in json">
        {{ value }}
        -->
        {{ key }}
      </li>
    </ul>
    <hr>
    循环对象 得到 key并得到 下标
    <ul>
      <li v-for="(value, key, index) in json">
        {{ value }}
        -->
        {{ key }}
        -->
        {{index}}
      </li>
    </ul>

    <div>
      <h2>姓名： {{json.name}}</h2>
      <p>年级: {{json.age}}</p>
      <h2>性别 {{json.gender}}</h2>
    </div>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      data: {
        arr: ['a', 'b', 'c', 'd'],
        json: {
          name: '小明',
          age: 18,
          gender: '男'
        }
      }
    })
    vm.$mount('#app');
  </script>
</body>

</html>